/*
**      $Filename: sys/stat.h $
**      $Release$
**      $Revision: 3.4 $
**      $Date: 1994/05/02 19:25:39 $
**
**      Unix-compatible stat() definitions for SAS/C
**
**      Copyright © 1993,1994 AmiTCP/IP Group, <AmiTCP-Group@hut.fi>
**                  Helsinki University of Technology, Finland.
**                  All rights reserved.
*/

OBJECT __stat
    st_dev:ULONG,         /* unique device id */
    st_ino:ULONG,         /* inode of file (key block) */
    st_mode:UWORD,        /* Unix style mode */
    st_nlink:UWORD,       /* number of links (unimplemented) */
    st_uid:LONG,         /* owner's user ID */
    st_gid:LONG,         /* owner's group ID */
    st_rdev:ULONG,        /* special file ID (unimplemented) */
    st_size:LONG,        /* file size */
    st_atime:LONG,       /* Time of last access */
    st_mtime:LONG,       /* Last modification time */
    st_ctime:LONG,       /* Last file status change time */
    st_blksize:LONG,     /* Size of disk block */
    st_blocks:LONG,      /* Size in blocks */
    st_dosmode:LONG,     /* DOS protection bits */
    st_type:WORD,        /* DOS file type */
    st_comment:PTR TO BYTE     /* DOS file comment */



#define S_ISUID 0004000         /* set user id on execution */
#define S_ISGID 0002000         /* set group id on execution */
#define S_ISVTX 0001000         /* save swapped text even after use */

#define S_IRWXU 0000700         /* RWX mask for owner */
#define S_IRUSR 0000400         /* R for owner */
#define S_IWUSR 0000200         /* W for owner */
#define S_IXUSR 0000100         /* X for owner */

#define S_IREAD         S_IRUSR
#define S_IWRITE        S_IWUSR
#define S_IEXEC         S_IXUSR

#define S_IRWXG 0000070         /* RWX mask for group */
#define S_IRGRP 0000040         /* R for group */
#define S_IWGRP 0000020         /* W for group */
#define S_IXGRP 0000010         /* X for group */

#define S_IRWXO 0000007         /* RWX mask for other */
#define S_IROTH 0000004         /* R for other */
#define S_IWOTH 0000002         /* W for other */
#define S_IXOTH 0000001         /* X for other */

#define S_IFMT   0170000        /* type of file */
#define S_IFCHR  0020000        /* character special */
#define S_IFDIR  0040000        /* directory */
#define S_IFBLK  0060000        /* block special */
#define S_IFREG  0100000        /* regular */
#define S_IFLNK  0120000        /* symbolic link */
#define S_IFSOCK 0140000        /* socket */
#define S_IFIFO  0010000        /* named pipe (fifo) */

#define S_BLKSIZE       512     /* block size used in the stat struct */

#define S_ISDIR(m)      ((m & 0170000) = 0040000)      /* directory */
#define S_ISCHR(m)      ((m & 0170000) = 0020000)      /* char special */
#define S_ISBLK(m)      ((m & 0170000) = 0060000)      /* block special */
#define S_ISREG(m)      ((m & 0170000) = 0100000)      /* regular file */
#define S_ISLNK(m)      ((m & 0170000) = 0120000)      /* symbolic link */
#define S_ISFIFO(m)     ((m & 0170000) = 0010000)      /* fifo */
#define S_ISSOCK(m)     ((m & 0170000) = 0140000)      /* socket */

/*
mode_t umask(mode_t);
int __chmod(const char *, int);
int __fstat(int, struct __stat *);
int __stat(const char *, struct __stat *);
int __lstat(const char *, struct __stat *);

#define chmod __chmod
#define fstat __fstat
#define stat  __stat
#define lstat __lstat
*/

